Adaptive method and system for encoding digital images for the internet

ABSTRACT

A system and method comprise defining a current rectangular region of the image bitmap, quantifying spectral characteristics of the current rectangular region, dividing the current rectangular region into four rectangular sub-regions in response to the spectral characteristics being greater than a predetermined threshold value, tagging the current rectangular sub-region as a terminal rectangular region in response to the spectral characteristics being less than or equal to the predetermined threshold value, tagging each rectangular sub-region as a terminal rectangular region in response to a size of the rectangular sub-region being less than or equal to a predetermined threshold size, defining one of the non-terminal rectangular sub-regions as the current rectangular region and repeating the above until all rectangular regions are tagged terminal, and determining color characteristics for each of the terminal rectangular regions.

BACKGROUND

A digital image is a representation of a two-dimensional picture orgraphics as a finite set of digital values, called picture elements orpixels. Typically, the pixels are stored in computer memory as a rasterimage or raster map expressed in a two-dimensional array of integers.These values are often transmitted or stored in a compressed form.Digital images can be created by a variety of input devices andtechniques, such as digital cameras, scanners, airborne radar, and more.They can also be synthesized from arbitrary non-image data, such asmathematical functions or three-dimensional geometric models in computergraphics, for example.

Common formats for digital image files include JPEG (Joint PhotographicExperts Group), GIF (Graphics Interchange Format), and PNG (PortableNetwork Graphics). However, these digital image formats are notcompatible with XML (extensible Markup Language), a text-based formatthat has increasingly become an important format for many World Wide Webor Internet technologies. These digital image files cannot be easilyembedded within XML and require a cumbersome re-encoding process thatchanges the binary digital image data into a format such as Base 64 thatis compatible with XML. These typical re-encoding processes greatlyincrease processing time as well as demanding larger network bandwidthduring electronic transmission.

BRIEF DESCRIPTION OF THE DRAWINGS

Aspects of the present disclosure are best understood from the followingdetailed description when read with the accompanying figures. It isemphasized that, in accordance with the standard practice in theindustry, various features are not drawn to scale. In fact, thedimensions of the various features may be arbitrarily increased orreduced for clarity of discussion.

FIG. 1 is a greatly simplified block diagram of an embodiment of asystem for encoding digital images for the Internet;

FIG. 2 is a simplified diagram of an embodiment of a method and systemfor encoding digital images for the Internet;

FIG. 3 is a simplified flowchart of an embodiment of a method forencoding digital images for the Internet;

FIG. 4 is a simplified flowchart of an embodiment of a method fordetermining spectral characteristics in a rectangular region underanalysis;

FIG. 5 is a simplified flowchart of an embodiment of a method fordetermining a split point for further sub-dividing a rectangular region;

FIG. 6 is a simplified flowchart of an embodiment of a method forcoloring terminal rectangles; and

FIG. 7 is a simplified diagram of a rectangular region with numerousrectangular sub-regions of various sizes.

DETAILED DESCRIPTION

FIG. 1 is a greatly simplified block diagram of an embodiment of asystem 10 encoding digital images for the Internet 12. System 10 may beany suitable computing device that has sufficient computing and memorystorage resources to execute the method described herein. System 10 maycomprise a personal computer, workstation, computer server, laptopcomputer, and portable or mobile computing devices now known or laterdeveloped. System 10 may be coupled or in communication with theInternet 12 for transmitting digital image files as well as other formsof data to and from another Internet-enabled device 14. Internet-enableddevice 14 may be a computer, computer server, printer, facsimilemachine, database, and/or any other suitable device that is operable toreceive, process, store, and/or output the digital image file.

FIG. 2 is a simplified diagram of an embodiment of a method and system10 for encoding digital images for the Internet. System 10 receives, asan input, a bitmap image file 16. Bitmap image file 16 may be in aformat such as JPEG (Joint Photographic Experts Group), GIF (GraphicsInterchange Format), and PNG (Portable Network Graphics). In bitmapimage file 16, the image is modeled as a one-to-one mapping of colorvalues onto equal-sized, equal-spaced picture elements or pixels. Thesepixels are typically arranged in a rectilinear mosaic or grid with afixed number of rows and columns. Using the process described herein,system 10 is operable to transform bitmap image file 16 into a vectorimage file 18 having a format compatible with XML (extensible MarkupLanguage), such as SVG (Scalable Vector Graphics). SVG is a vectorimaging technology in which images are modeled as lines, polygons,ellipses, and other geometric primitives. SVG is a scalable format interms of resolution, color spaces, and available bandwidth, and isespecially suitable to mobile and limited-resource applications such aspersonal digital assistant (PDA) devices and mobile phones. System 10may also receive, via a graphical user interface (GUI) 20 for example,user input of parameters that may be used to tune or adjust the digitalfile encoding process. Details of the encoding process are providedbelow.

FIG. 3 is a simplified flowchart of an embodiment of a method 30 forencoding digital images for the Internet. In step 32, an input imagefile 16 (FIG. 2) is received. Image file 16 is a bitmap file thatincludes a two-dimensional pixel array as described above. In step 34, arectangular region for analysis is defined. In the initial pass, therectangular region is defined as the entire image represented in theimage file, such as image 120 in FIG. 7. In subsequent recursive passes,the rectangular region for analysis will become increasingly smallerrectangular areas generated by sub-dividing the initial rectangularregion. In step 36, the spectral characteristics of the rectangularregion is determined. The spectral characteristics of the rectangularregion quantify the frequency spectrum or amount of details orvariations that are presents in the rectangular region. Areas of finedetail should be further subdivided for analysis, but areas with verylittle variation in pixel values need not be further divided intosmaller rectangular regions. Details of the process to determinespectral characteristics is described below with reference to FIG. 4. Instep 38, the spectral characteristics value is compared with a thresholdvalue. If the spectral characteristics value is greater than thethreshold value, then the rectangular region contains many more detailsand should be further divided into rectangular sub-regions for analysis.Therefore, the rectangular region is tagged or otherwise flagged forsplitting or subdividing in step 40.

In step 42, a split point representing the point common to all four ofthe sub-divided rectangular regions is determined such as split point122 in FIG. 7 for dividing the image. The split point is chosen tominimize information loss in the final rendered vector image as comparedwith the original bitmap image. The exact location of the split pointmay be determined via some heuristic algorithm. Details of this processis described below with reference to FIG. 5. In step 44, the currentrectangular region is divided into rectangular sub-regions substantiallyhorizontally and vertically from the split point to the boundaries ofthe rectangular region. In the example shown in FIG. 7, the initialrectangular region has been divided into four rectangular sub-regions124-127. The divided rectangular sub-regions are likely to havedifferent sizes and aspect ratios. In step 46, each of the rectangularsub-regions are compared with a threshold size. If the size of arectangular sub-region is smaller than the threshold size, then therectangular sub-region has reached a size that cannot be furtherdivided. If the size of the resultant rectangular region is greater thanor equal to the threshold size, then in step 48 that region is tagged orotherwise flagged for further analysis. In step 50, the taggedrectangular regions are defined for further analysis as executionproceeds to step 36. The process proceeds recursively and analyzes eacharea of the image until all rectangular regions of the image are taggedas “terminal” and thus do not require further subdivision and analysis.In the example shown in FIG. 7, rectangular sub-region 124 is dividedinto regions 130-134 by selecting split point 136. This processcontinues until all rectangular regions are flagged as “terminal.”

If in step 46 the rectangular sub-region size is smaller than thethreshold size, then the rectangular sub-region is tagged or flagged asa “terminal” rectangle in step 52. A terminal rectangle is not furtherdivided into sub-regions. In addition to a size threshold comparison, arectangular region can also become a terminal rectangle if its spectralcharacteristics are determined to not exceed a threshold value in step38. In this case, the rectangular region does not contain sufficientdetails or variations that requires further sub-division and analysis.The process proceeds recursively until all areas of the image are taggedas “terminal” rectangles that require no further subdivision andanalysis.

In step 54, a determination is made as to whether there are any morenon-terminal rectangular regions for analysis. If there are, the nextrectangular region is defined for analysis in step 34. If there are nomore non-terminal rectangular regions for analysis, then the colorcharacteristics of the terminal rectangles are determined in step 56.Details of this coloring process is described below with reference toFIG. 6. In step 58, the terminal rectangles are “colored” accordingly.In step 60, the dimensional and color-fill characteristics of allterminal rectangles are mapped to corresponding SVG constructs, and thenthe SVG constructs are made transmissible on physical media in the formof XML. The process ends in step 62.

It should be noted that all of the steps in method 30 may be performedserver-side and the results communicated to a client computer.Alternatively, some of the steps may be performed server-side and theremaining steps carried out client-side so that the SVG constructmaterializes on the client system. The client-side operations may beperformed by an applet, in client application's executable logic, or ina Java script or other interpreter under the control of the clientapplication. The tuning parameters and image data may be communicatedfrom a client to the server and the final image file based in XMLcommunicated to the client. The client computer may perform therendering function where the server transmits the rectangular regiondata in sorted order, such as from largest to smallest in size, or fromone corner to the opposing corner, to the client.

FIG. 4 is a simplified flowchart of an embodiment of a method 36 fordetermining the spectral characteristics in a rectangular region underanalysis. In step 70, an optional tuning value is received. The gain ortuning parameter may be used to adjust the spectral frequencycalculation to take into account of the size of the rectangular region,the recursive level, and/or other factors. The gain value setting may bereceived from a user or from determinations made by algorithms in method30, for example. In step 72, a root-mean-square error metric iscalculated based on the pixel variances to determine a mean luminancevalue which quantifies the spectral frequency or characteristics of therectangular region. The process returns in step 74. It should be notedthat this example is but one way to determine the spectral frequency orentropy of the region.

FIG. 5 is a simplified flowchart of an embodiment of a method 42 fordetermining a split point for further sub-dividing a rectangular region.The method looks at each pixel in the rectangular region andheuristically determines a “center of gravity” of the rectangularregion. In step 80, the method determines the product of the currentpixel's color value and its relative x-position in the rectangularregion normalized on the unit interval. This yields the pixel's momentin x or its x-moment. In step 82, the same is calculated in the y-axisto multiply the same pixel's color value with the pixel's relativey-position in the rectangular region. This yields the y-moment. Steps 80and 82 are performed recursively until all pixels in the currentrectangular region is processed. In step 84, the average luminance valueof the rectangular region is determined by determining the luminancevalue of each pixel and divided by the number of pixels. In step 86, thecenter-of-gravity of the rectangular region in x is determined bycalculating the sum of all the x-moments and divide it by the averageluminance value. In step 88, the same is performed for the y-axis bysumming all the y-moments and dividing the sum by the average luminancevalue. The center-of-gravity in x and the center-of-gravity in y socomputed are the x and y-coordinates of the center-of-gravity of thegiven rectangular region. In step 90, an optional split point tuningparameter is received from a user or some other function of method 30.The gain may be correlated to the size of the rectangular region and/orrecursive depth and/or some other factors so that the returned value isdependent on the recursive level of the current rectangular region. Instep 92, the split point is determined by using a modulatable functionthat relies on the center-of-gravity value and the received tuningvalue. For example, the split point in the x-axis may be given by:split point in x=a+gain*(b−a),where “a” is the geometric center of the rectangular region and “b” isthe center-of-gravity in the x-axis. The resultant split point is thepoint common to all four child rectangular sub-regions divided from thecurrent rectangular region. The resultant rectangular sub-regions areanalyzed unless the spectral frequency or the size of the sub-region isbelow predetermined respective threshold values.

FIG. 6 is a simplified flowchart of an embodiment of a method 58 forcoloring the terminal rectangles. This method determines, heuristically,how to color-fill the rectangular region at rasterization time. In step100, a first color algorithm is applied. A color algorithm determines away to apply one or more color values to the rectangular region. Forexample, one color algorithm may apply one color uniformly in therectangular region. Another color algorithm may select two anchor pointsand apply two colors respectively across the rectangular region usinginterpolation techniques to apply the colors in a linear or nonlineargradient. The anchor points may be located at opposing corners of therectangular region, for example. In steps 102 and 104, the color-filledresult is compared with the original bitmap and their differences noted.In step 106, if there are more color algorithms to try, then it isapplied until all color algorithms have been attempted and theirrespective comparisons with the original bitmap noted. In steps 108 and110, the comparison differences of the color algorithms are compared todetermine one color algorithm that yields the least difference. In thismanner, “information loss” in the transformation process is minimized.The result is then returned in step 112. A pointer pointing to theselected color algorithm may be returned in this manner so that thealgorithm may be applied at image rendering time. It may be seen thatdifferent color algorithms or fill heuristics are likely to be appliedto different rectangular regions of an image. The color-fill algorithmmay involve SVG gradients and opacity and transparency values as definedin SVG specifications.

It may be seen that all the final geometric and color data are expressedin XML that conforms to the SVG specifications set by the World Wide WebConsortium (W3C). This enables image files to be easily embedded in XMLfor transmission via the Web, and transformed, stored, manipulated andrendered in a SVG-capable environment. Unlike other bitmap-to-vectorconversion methods, this method is not computationally intensive. Thegeometric primitives created by this method, namely rectangles, may berendered with speed. The size of the resulting SVG file may becontrolled using the tuning variables. This system and method provide afast, lossy transcoding of bitmap image data to a vector formatdescribed in a well-known XML grammar, and provides a scale-sensitivemethod that gives the user the ability to fine-tune parameters withrespect to the retention of image fidelity. The resultant rectangularsub-regions are tagged or provided with vector-rendering “hints” orinformation to reconstruct the image in a fidelity-optimized manner.

It should be noted that some steps of the method described above may beperformed server-side while others may be performed client-side. Forexample, all the steps of the method up to step 58 may be performedserver-side, and then the SVG construct materializes on the client.Further, tuning parameters may be received at the client side and thentransmitted to the server where the conversion takes place. Progressiverendering may also take place on the client where the server transmitsrectangular region data in some sorted order (such as from largest tosmallest rectangular regions, or according to their positions in theimage) to the client for rendering.

Although embodiments of the present disclosure have been described indetail, those skilled in the art should understand that they may makevarious changes, substitutions and alterations herein without departingfrom the spirit and scope of the present disclosure. Accordingly, allsuch changes, substitutions and alterations are intended to be includedwithin the scope of the present disclosure as defined in the followingclaims. In the claims, means-plus-function clauses are intended to coverthe structures described herein as performing the recited function andnot only structural equivalents, but also equivalent structures.

1. A method comprising using a processor to perform the steps of:receiving an image bitmap; defining the image bitmap as a currentrectangular region; quantifying spectral characteristics of the currentrectangular region; comparing the spectral characteristics to apredetermined threshold value; dividing the current rectangular regioninto four rectangular sub-regions in response to the spectralcharacteristics being greater than the predetermined threshold value;tagging the current rectangular sub-region as a terminal rectangularregion in response to the spectral characteristics being less than orequal to the predetermined threshold value; comparing respective sizesof each of the four rectangular sub-regions to a predetermined thresholdsize; tagging each rectangular sub-region for further subdivision inresponse to the size of the rectangular sub-region being greater thanthe predetermined threshold size; tagging each rectangular sub-region asa terminal rectangular region in response to the size of the rectangularsub-region being less than or equal to the predetermined threshold size;defining one of the rectangular sub-regions as the current rectangularregion and repeating the above until all rectangular regions are taggedterminal; determining color characteristics for each of the terminalrectangular regions; mapping the dimensional and coloringcharacteristics to a vector construct; and converting the vectorconstruct to a text-based Internet format.
 2. The method of claim 1,further comprising determining a split point common to all fourrectangular sub-regions for subdividing the current rectangular region.3. The method of claim 2, wherein determining a split point comprisesdetermining a center-of-gravity of the rectangular region based on colorvalues of pixels in the rectangular region and an average luminancevalue of the rectangular region.
 4. The method of claim 2, whereindetermining a split point comprises: determining a moment in x for eachpixel in the rectangular region; determining a moment in y for eachpixel in the rectangular region; determining an average luminance valuefor the rectangular region; determining a center-of-gravity in x usingthe moment in x of the pixels in the rectangular region and averageluminance value; determining a center-of-gravity in y using the momentin x of the pixels in the rectangular region and average luminancevalue; and determining a split point in response to thecenter-of-gravity in x and center-of-gravity in y.
 5. The method ofclaim 4, wherein determining a split point comprises tuning the splitpoint determination using a tuning value based on a number of recursiveiterations in sub-dividing the rectangular region.
 6. The method ofclaim 4, wherein determining a split point comprises tuning the splitpoint determination using a tuning value based on size of therectangular region being subdivided.
 7. The method of claim 1, whereindetermining color characteristics for each of the terminal rectangularregions comprises: selecting a color fill algorithm; comparing result ofthe selected color fill algorithm to image bitmap and quantify adifference thereof; selecting additional color fill algorithms andcomparing results to image bitmap and quantify differences thereof; andselecting one color fill algorithm having the least difference.
 8. Themethod of claim 1, wherein quantifying spectral characteristics of thecurrent rectangular region comprises: receiving a gain relating to asize of the rectangular region; and determining a mean luminance valueof the rectangular region in response to the gain.
 9. The method ofclaim 1, wherein quantifying spectral characteristics of the currentrectangular region comprises: receiving a gain relating to a number ofrecursive iterations in sub-dividing the rectangular region; anddetermining a mean luminance value of the rectangular region in responseto the gain.
 10. The method of claim 1, wherein mapping the dimensionaland coloring characteristics to a vector construct comprises mapping toa Scalable Vector Graphics construct.
 11. The method of claim 1, whereinconverting the vector construct to a text-based Internet formatcomprises converting the vector construct to XML.
 12. A method ofconverting an image bitmap comprising using a processor to perform thesteps of: defining a current rectangular region of the image bitmap;quantifying spectral characteristics of the current rectangular region;dividing the current rectangular region into four rectangularsub-regions in response to the spectral characteristics being greaterthan a predetermined threshold value; tagging the current rectangularsub-region as a terminal rectangular region in response to the spectralcharacteristics being less than or equal to the predetermined thresholdvalue; tagging each rectangular sub-region as a terminal rectangularregion in response to the size of the rectangular sub-region being lessthan or equal to a predetermined threshold size; defining one of thenon-terminal rectangular sub-regions as the current rectangular regionand repeating the above until all rectangular regions are taggedterminal; and determining color characteristics for each of the terminalrectangular regions.
 13. The method of claim 12, further comprising:mapping the dimensional and coloring characteristics to a vectorconstruct; and converting the vector construct to a text-based Internetformat.
 14. The method of claim 12, further comprising determining asplit point common to all four rectangular sub-regions for subdividingthe current rectangular region.
 15. The method of claim 14, whereindetermining a split point comprises determining a center-of-gravity ofthe rectangular region based on color values of pixels in therectangular region and an average luminance value of the rectangularregion.
 16. The method of claim 14, wherein determining a split pointcomprises: determining a moment in x for each pixel in the rectangularregion; determining a moment in y for each pixel in the rectangularregion; determining an average luminance value for the rectangularregion; determining a center-of-gravity in x using the moment in x ofthe pixels in the rectangular region and average luminance value;determining a center-of-gravity in y using the moment in x of the pixelsin the rectangular region and average luminance value; and determining asplit point in response to the center-of-gravity in x andcenter-of-gravity in y.
 17. The method of claim 16, wherein determininga split point comprises tuning the split point determination using atuning value based on a number of recursive iterations in sub-dividingthe rectangular region.
 18. The method of claim 16, wherein determininga split point comprises tuning the split point determination using atuning value based on size of the rectangular region being subdivided.19. The method of claim 12, wherein determining color characteristicsfor each of the terminal rectangular regions comprises: selecting acolor fill algorithm; comparing result of the selected color fillalgorithm to image bitmap and quantify a difference thereof; selectingadditional color fill algorithms and comparing results to image bitmapand quantify differences thereof; and selecting one color fill algorithmhaving the least difference.
 20. The method of claim 12, whereinquantifying spectral characteristics of the current rectangular regioncomprises: receiving a gain relating to a size of the rectangularregion; and determining a mean luminance value of the rectangular regionin response to the gain.
 21. The method of claim 12, wherein quantifyingspectral characteristics of the current rectangular region comprises:receiving a gain relating to a number of recursive iterations insub-dividing the rectangular region; and determining a mean luminancevalue of the rectangular region in response to the gain.
 22. The methodof claim 13, wherein mapping the dimensional and coloringcharacteristics to a vector construct comprises mapping to a ScalableVector Graphics construct.
 23. The method of claim 13, whereinconverting the vector construct to a text-based Internet formatcomprises converting the vector construct to XML.
 24. A systemcomprising: a graphical user interface operable to receive user input; aCPU; a memory storing computer-readable code executable by said CPU,operable to perform: defining a current rectangular region of the imagebitmap; quantifying spectral characteristics of the current rectangularregion; dividing the current rectangular region into four rectangularsub-regions in response to the spectral characteristics being greaterthan a predetermined threshold value; “tagging” the current rectangularsub-region as a terminal rectangular region in response to the spectralcharacteristics being less than or equal to the predetermined thresholdvalue; tagging each rectangular sub-region as a terminal rectangularregion in response to a size of the rectangular sub-region being lessthan or equal to a predetermined threshold size; defining one of thenon-terminal rectangular sub-regions as the current rectangular regionand repeating the above until all rectangular regions are taggedterminal; and determining color characteristics for each of the terminalrectangular regions.
 25. The system of claim 24, wherein thecomputer-readable code further performs: mapping the dimensional andcoloring characteristics to a vector construct; and converting thevector construct to a text-based Internet format.
 26. The system ofclaim 24, wherein the computer-readable code further performsdetermining a split point common to all four rectangular sub-regions forsubdividing the current rectangular region.
 27. The system of claim 26,wherein determining a split point comprises determining acenter-of-gravity of the rectangular region based on color values ofpixels in the rectangular region and an average luminance value of therectangular region.
 28. The system of claim 26, wherein determining asplit point comprises: determining a moment in x for each pixel in therectangular region; determining a moment in y for each pixel in therectangular region; determining an average luminance value for therectangular region; determining a center-of-gravity in x using themoment in x of the pixels in the rectangular region and averageluminance value; determining a center-of-gravity in y using the momentin x of the pixels in the rectangular region and average luminancevalue; and determining a split point in response to thecenter-of-gravity in x and center-of-gravity in y.
 29. The system ofclaim 28, wherein determining a split point comprises tuning the splitpoint determination using a tuning value based on a number of recursiveiterations in sub-dividing the rectangular region.
 30. The system ofclaim 28, wherein determining a split point comprises tuning the splitpoint determination using a tuning value based on size of therectangular region being subdivided.
 31. The system of claim 24, whereindetermining color characteristics for each of the terminal rectangularregions comprises: selecting a color fill algorithm; comparing result ofthe selected color fill algorithm to image bitmap and quantify adifference thereof; selecting additional color fill algorithms andcomparing results to image bitmap and quantify differences thereof; andselecting one color fill algorithm having the least difference.
 32. Thesystem of claim 24, wherein quantifying spectral characteristics of thecurrent rectangular region comprises: receiving a gain relating to asize of the rectangular region; and determining a mean luminance valueof the rectangular region in response to the gain.
 33. The system ofclaim 24, wherein quantifying spectral characteristics of the currentrectangular region comprises: receiving a gain relating to a number ofrecursive iterations in sub-dividing the rectangular region; anddetermining a mean luminance value of the rectangular region in responseto the gain.
 34. The system of claim 25, wherein mapping the dimensionaland coloring characteristics to a vector construct comprises mapping toa Scalable Vector Graphics construct.
 35. The system of claim 25,wherein converting the vector construct to a text-based Internet formatcomprises converting the vector construct to XML.
 36. A systemcomprising: means for defining a current rectangular region of the imagebitmap; means for quantifying spectral characteristics of the currentrectangular region; means for dividing the current rectangular regioninto four rectangular sub-regions in response to the spectralcharacteristics being greater than a predetermined threshold value;means for tagging the current rectangular sub-region as a terminalrectangular region in response to the spectral characteristics beingless than or equal to the predetermined threshold value; means fortagging each rectangular sub-region as a terminal rectangular region inresponse to a size of the rectangular sub-region being less than orequal to a predetermined threshold size; means for defining one of thenon-terminal rectangular sub-regions as the current rectangular regionand repeating the above until all rectangular regions are taggedterminal; and means for determining color characteristics for each ofthe terminal rectangular regions.
 37. The system of claim 36, furthercomprising: means for mapping the dimensional and coloringcharacteristics to a vector construct; and means for converting thevector construct to a text-based Internet format.